package com.jcp.daoimp;

import java.util.List;

import com.jcp.dao.LateAndOvertimeUsersDao;
import com.jcp.entity.LateAndOvertimeUsers;
import com.jcp.entity.OverTime;
import com.jcp.util.DBUtil;
/**
 * LateAndOvertimeUsers的dao 实现
 * @author Administrator
 *
 */
//查看今天迟到名单
public class LateAndOvertimeUsersDaoImp implements LateAndOvertimeUsersDao {

	@Override
	public List<LateAndOvertimeUsers> getLateUsers(String atttime,int attflag) {
		// TODO Auto-generated method stub
		String sql="SELECT users.userId,userName,attTime,photosurl\r\n" + 
				"from users\r\n" + 
				"INNER JOIN attences on users.userId=attences.userId\r\n" + 
				"INNER JOIN files  on users.userId=files.fileId\r\n" + 
				"where atttime > ? and attflag=?";
		List<LateAndOvertimeUsers> list =DBUtil.exQuery(sql, LateAndOvertimeUsers.class, atttime,attflag);
		return list ;
	}
    //查看昨日加班名单
	@Override
	public List<OverTime> getOvertiomeUsers(String today,int attflag) {
		// TODO Auto-generated method stub
		String sql="\r\n" + 
				"SELECT users.userId,userName,overTime,deptName,photosurl\r\n" + 
				"from users\r\n" + 
				"INNER JOIN attences on users.userId=attences.userId\r\n" + 
				"INNER JOIN files  on users.userId=files.fileId\r\n" + 
				"INNER JOIN departments  on users.deptId=departments.deptId\r\n" + 
				"WHERE DATEDIFF(now(),atttime) = 1 and attflag=?";
		List<OverTime> list =DBUtil.exQuery(sql, OverTime.class, attflag);
		return list ;
	}

}
